<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>字母移位</title>
</head>
<body>
  <script>
    function fn(s, shifts) {
      let arr = 'abcdefghijklmnopqrstuvwxyz'.split('')
      let index = 0, ans = []
      for (let i = s.length - 1; i >= 0; i--) {
        index += shifts[i]
        ans.push(arr[(s[i].charCodeAt() + index - 97) % 26])
      }
      return ans.reverse().join('');
    }
    console.log(fn("abc", [3, 5, 9]))
  </script>
</body>
</html>